﻿<UserControl x:Class="MouseExtender.Controls.UserControls.SettingsUC"
                         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                         xmlns:common="clr-namespace:MouseExtender.Logic.Common"
                         xmlns:converters="clr-namespace:MouseExtender.Logic.Converters"
                         xmlns:resx="clr-namespace:MouseExtender.Resources"
                         FontSize="11" Loaded="SettingsUC_Loaded">
    <UserControl.Resources>
        <converters:PeriodConverter x:Key="PeriodConverter"/>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Foreground" Value="#FF333333"/>
        </Style>
        <Style TargetType="{x:Type TextBox}" x:Key="Default">
            <Setter Property="Foreground" Value="#FF000000"/>
        </Style>
        <Style TargetType="{x:Type TextBox}" x:Key="WaterMark">
            <Setter Property="Foreground" Value="Gray"/>
        </Style>
    </UserControl.Resources>
    <Grid Width="250">
        <Grid.RowDefinitions>
            <RowDefinition Height="350"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <TabControl Grid.Row="0" Background="Transparent" Margin="5" Style="{StaticResource SettingsTabStyle}">
            <TabItem Name="tiGeneralSettings" Header="{x:Static resx:UIResources.Settings_TabGeneral}" Background="Transparent" 
                     Style="{StaticResource SettingsTabItemStyle}">
                <StackPanel HorizontalAlignment="Left" Grid.Row="0" Orientation="Vertical" Margin="10">
                    <CheckBox x:Name="chUseCompactView" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_CompactView}"/>
                    </CheckBox>
                    <CheckBox x:Name="chAutoStart" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_Autostart}"/>
                    </CheckBox>
                    <CheckBox x:Name="chShowSystemButtonsBar" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_ShowSystemButtons}"/>
                    </CheckBox>
                    <CheckBox x:Name="chHideOnMiddleClickWhenOpened" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_HideOnClick}"/>
                    </CheckBox>
                    <CheckBox x:Name="chDontHidePanel" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_AlwaysOnTop}"/>
                    </CheckBox>
                    <CheckBox x:Name="chHideCloseButton" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_HideClose}"/>
                    </CheckBox>
                    <CheckBox x:Name="chUseHWAcceleration" Foreground="#FF222222" Margin="6">
                        <TextBlock Margin="3,0,0,0" Text="{x:Static resx:UIResources.Settings_HWAcceleration}"/>
                    </CheckBox>
                    <TextBlock DockPanel.Dock="Top" Text="{x:Static resx:UIResources.Settings_ExcludedPrograms}"/>
                    <StackPanel Orientation="Horizontal">
                        <ComboBox x:Name="cbExcludedPrograms" ItemTemplate="{StaticResource ExcludedProgramItemTemplate}" Width="140" Margin="2"/>
                        <Button Content="-" Click="btnRemoveExcludedProgram_Click" Padding="0" Height="20" Width="20" Margin="2,0,2,0"/>
                        <Button Content="+" Click="btnAddExcludedProgram_Click" Padding="0" Height="20" Width="20" Margin="2,0,0,0"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Grid.Column="0" Foreground="#FF222222" FontSize="11" HorizontalAlignment="Left" Margin="0,6,5,6" Text="{x:Static resx:UIResources.Settings_IconsInRow}"/>
                        <Slider x:Name="slIconsInRow" Grid.Column="1" Minimum="1" Maximum="10" IsSnapToTickEnabled="True" Margin="5,6,10,6" Width="100" Value="{Binding Text, ElementName=lblIconsInRow}"/>
                        <TextBlock x:Name="lblIconsInRow" Grid.Column="2" Width="25" Margin="0,6,5,6" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Grid.Column="0" Foreground="#FF222222" FontSize="11" HorizontalAlignment="Left" Margin="0,6,5,6" Text="{x:Static resx:UIResources.Settings_CheckUpdates}"/>
                        <Slider x:Name="slUpdatePeriod" Grid.Column="1" Maximum="4" IsSnapToTickEnabled="True" Margin="5,6,10,6" Width="87" SmallChange="1"/>
                        <TextBlock x:Name="lblUpdatePeriod" Grid.Column="2" Width="70" Margin="0,6,5,6" Text="{Binding Value, Converter={StaticResource PeriodConverter}, ElementName=slUpdatePeriod, Mode=Default}"/>
                    </StackPanel>
                </StackPanel>
            </TabItem>
            <TabItem Name="tiNetwork" Header="{x:Static resx:UIResources.Settings_TabNetwork}" Background="Transparent"
                     Style="{StaticResource SettingsTabItemStyle}">
                <StackPanel>
                    <TextBlock Text="{x:Static resx:UIResources.Settings_TabNetwork_SectionTitle}" Margin="0,0,0,3"/>
                    <Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3">
                        <StackPanel>
                            <RadioButton Margin="3" Name="rbAutoDetect" IsChecked="True" Content="{x:Static resx:UIResources.Settings_TabNetwork_AutoDetect}" />
                            <RadioButton Margin="3" Name="rbManualProxyConfiguration" Content="{x:Static resx:UIResources.Settings_TabNetwork_Manual}" />
                            <Border Name="brdManual" CornerRadius="3" Padding="5" Margin="3" IsEnabled="{Binding ElementName=rbManualProxyConfiguration, Path=IsChecked}" BorderBrush="Gray" BorderThickness="1">
                                <StackPanel>
                                    <TextBlock Text="{x:Static resx:UIResources.Settings_TabNetwork_HttpProxy}"/>
                                    <TextBox Name="tbHttpProxy" Margin="0,0,0,10" />
                                    <CheckBox Name="cbProxyAuthenticationEnabled" Content="{x:Static resx:UIResources.Settings_TabNetwork_EnableProxyAuth}" IsChecked="False"/>
                                    <Border BorderBrush="Gray" BorderThickness="1" CornerRadius="3" Margin="3" Padding="3" IsEnabled="{Binding ElementName=cbProxyAuthenticationEnabled, Path=IsChecked}">
                                        <StackPanel>
                                            <TextBlock Text="{x:Static resx:UIResources.Settings_TabNetwork_Login}"/>
                                            <TextBox Name="tbLogin"/>
                                            <TextBlock Text="{x:Static resx:UIResources.Settings_TabNetwork_Password}" />
                                            <PasswordBox Name="tbPassword"  ToolTip="{x:Static resx:UIResources.Settings_TabNetwork_PasswordTooltip}"/>
                                        </StackPanel>
                                    </Border>
                                </StackPanel>
                            </Border>
                        </StackPanel>
                    </Border>
                </StackPanel>
            </TabItem>
            <TabItem Header="{x:Static resx:UIResources.Settings_TabShortcut}" Background="Transparent"
                     Style="{StaticResource SettingsTabItemStyle}">
                <StackPanel>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Margin="0,0,5,0" Text="{x:Static resx:UIResources.Settings_MouseConfiguration}" />
                        <TextBox x:Name="txtMouseButtonsCombination" Margin="0,0,5,0" Focusable="False" Style="{StaticResource Default}" MouseDown="txtMouseButtonsCombination_MouseDown" MouseEnter="txtMouseButtonsCombination_MouseEnter" MouseLeave="txtMouseButtonsCombination_MouseLeave" PreviewMouseDown="txtMouseButtonsCombination_MouseDown" ContextMenuService.IsEnabled="False" FontSize="10.667" Cursor="Hand">
                            <TextBox.ContextMenu>
                                <ContextMenu/>
                            </TextBox.ContextMenu>
                        </TextBox>
                    </StackPanel>
                    <StackPanel Orientation="Vertical">
                        <TextBlock Margin="0,0,5,0" Text="{x:Static resx:UIResources.Settings_KeyboardConfiguration}" />
                        <TextBox x:Name="txtKeyboardShortcut" PreviewKeyDown="txtKeyboardShortcut_PreviewKeyDown"
                                 Margin="0,0,5,0" ContextMenuService.IsEnabled="False" FontSize="10.667" >
                            <TextBox.ContextMenu>
                                <ContextMenu/>
                            </TextBox.ContextMenu>
                        </TextBox>
                    </StackPanel>
                </StackPanel>
            </TabItem>
        </TabControl>
        <StackPanel HorizontalAlignment="Right" Grid.Row="1" Orientation="Horizontal" Margin="5,5,10,10">
            <Button Command="common:Commands.ApplySettings" Style="{StaticResource SettingsButtons}" IsDefault="True" Content="{x:Static resx:UIResources.Buttons_OK}"/>
            <Button Command="common:Commands.CancelPopup" Style="{StaticResource SettingsButtons}" IsCancel="True" Content="{x:Static resx:UIResources.Buttons_Cancel}"/>
        </StackPanel>
    </Grid>
</UserControl>
